{% extends 'layout.html' %}

{% block content %}
    <div id="msg" style="position: fixed;top: 50px;left: 0;right:0;margin:0 auto;width: 300px;text-align: center; ">
        {#                <div class="alert alert-success">添加成功</div>#}
        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-{{ message.tags }}" role="alert">{{ message }}</div>
            {% endfor %}
        {% endif %}
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading"> 个人资料</div>
                <div class="panel-body">

                    <form class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">用户名</label>
                            <div class="col-sm-10">
                                <p class="form-control-static">{{ instance.username }}</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">余额</label>
                            <div class="col-sm-10">
                                <p class="form-control-static">{{ instance.balance }}</p>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading"> 重置密码</div>
                <div class="panel-body">
                    <form method="post" novalidate>
                        {% csrf_token %}

                        {% for field in form %}

                            <div class="form-group" style="position: relative;margin-bottom: 25px">
                                <label for="{{ field.id_for_label }}">
                                    {{ field.label }}
                                    {% if field.help_text %}
                                        <span style="font-weight: 400;color: #333333;">（{{ field.help_text }}）</span>
                                    {% endif %}
                                </label>
                                {{ field }}
                                <span style="color: red;position: absolute;">{{ field.errors.0 }}</span>
                            </div>
                        {% endfor %}

                        <button type="submit" class="btn btn-primary">保 存</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block js %}

    <script>
        setTimeout(function () {
            $("#msg").empty()
        }, 3000)
    </script>
{% endblock %}